package 中国.杨森.实验室.rtsp.手机播放.基础;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.AudioElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;

public class 入口 implements EntryPoint
{
	@Override
	public void onModuleLoad()
	{
		单击("播放", new A操作事件监听器()
			{
				@Override
				public void 执行(Event 事件)
				{
					InputElement i = (InputElement) Document.get().getElementById("rtsp地址");
					播放视频(i.getValue());
				}
			});

		单击("提示音", new A操作事件监听器()
			{
				@Override
				public void 执行(Event 事件)
				{
					AudioElement a = (AudioElement) Document.get().getElementById("bj");
					a.play();
				}
			});

		new Timer()
			{
				int x = 0;

				@Override
				public void run()
				{
					x++;
					log("日志" + x);
				}
			}.scheduleRepeating(1000);
	}

	private final native void log(String m)/*-{
		console.log(m);
	}-*/;

	private final native void 播放视频(String url)/*-{
		$wnd.VideoPlayerVLC.play(url);
	}-*/;

	public final native void 单击(String id, A操作事件监听器 jt)/*-{
 		$wnd.$("#" + id).bind("click",function(event){
			jt.@中国.杨森.实验室.rtsp.手机播放.基础.A操作事件监听器::执行(Lcom/google/gwt/user/client/Event;)(event)
 		});
	}-*/;
}
